include_directories(${PROJECT_SOURCE_DIR}/src/gui)

#qrc_files GLOB only
file(GLOB qrc_files ../resources/*.qrc)
qt5_add_resources(generated_qrc_files ${qrc_files})

#translations GLOB_RECURSE all
file(GLOB_RECURSE HEAD_FILES ../*.h)
file(GLOB_RECURSE CPP_FILES ../*.cpp)
file(GLOB_RECURSE UI_FILES ../*.ui)

#translation
set(TS_FILES ../resources/translations/app_zh.ts)
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
qt5_create_translation(generated_qm_files ${HEAD_FILES} ${CPP_FILES} ${UI_FILES} ${TS_FILES})
add_custom_target(translations DEPENDS ${generated_qm_files})

#main.exe
add_executable(main main.cpp appearance.h appearance.cpp ${generated_qrc_files})
add_dependencies(main translations)
target_link_libraries(main HIMgui)

#设置是否带控制终端
set_target_properties(main PROPERTIES
    WIN32_EXECUTABLE TRUE
)
